	// 公共方法调用区
	function geetdata(url, opation, htmlurl, scripturl, cookies, isLog) {
		$.getJSON(url, opation, function(json){
			// 日志打印模块
			
			  view(json,  htmlurl, scripturl); // 负责界面显示数据
			  
			  if(cookies != '') {
				  opation.pageCount = json.data.pageCount;
				  opation.total = json.data.total; 
				  saveOpation(cookies, JSON.stringify(opation));   // 负责保存查询数据条件信息
			  }
			 
		})
	}
	function view(json, htmlurl, scripturl) {
		var $varietyContent = $(htmlurl),
	  	varietyHtml = template(scripturl, json);
		$varietyContent.html(varietyHtml);
		
	}
	
	function saveOpation(name, value) {
		$.cookie(name,value,{path:'/'});
	}
	function pre(name, url, htmlurl, scripturl, cookies, isLog) {
		var value = $.cookie(name);
		var opation = JSON.parse(value);
		if(opation.pageNo > 1) {
			opation.pageNo = opation.pageNo - 1;
		}
		geetdata(url, opation, htmlurl, scripturl, name, isLog);
	}
	function next(name, url, htmlurl, scripturl, cookies, isLog) {
		var value = $.cookie(name);
		var opation = JSON.parse(value);
		if(opation.pageNo < opation.pageCount) {
			opation.pageNo = opation.pageNo + 1;
		}
		geetdata(url, opation, htmlurl, scripturl, name, isLog);
	}
	
	function geetImg(imgUrl, n) {
		if(imgUrl == '') {
			return null;
		}
		if(n=='') {
			return imgUrl;
		}
		var imgurls = new Array();
		imgurls = imgUrl.split(',');
		if(n>imgurls.length+1) {
//			alert('传递的参数有误！');
		} else {
			return imgurls[n-1];
		}
		return '';
	}
	template.helper("geetImgByIndex", geetImg);
	
//	function openUrl(url , isNew){
//		if(isNew) {
//			window.open(url);
//		} else {
//			window.location.href = url;
//		}
//	
//	
//	}
	/**
	 * 调用示例：
	 * 1.改变图片选取位置
	 	
		<img src="{{value.imgUrl | geetImgByIndex:'1'}}" alt="图片"/>
	 */
	
$(function(){
	
	// 填充  页头（鸿鑫精神）
	var par = {
			cid:301,
			status:1,
			pageNo:1,
			pageSize:1
	};
//	geetdata("../../article/pagelist.do", par, "#hxjs", "hxjs_list", null, true);
//	var par = {
//			id:145803446519248
//	};
	//geetdata("../../articledetail/list.do", par, "#hxjs", "hxjs_list", null, true);
//	geetdata("../../articledetail/pagelist.do", par, "#hxjs", "hxjs_list", null, true);
	
	// 填充  企业VI 
	
	
	// 填充   文化动态
	var par = {
			cid:302,
			status:1,
			pageNo:1,
			pageSize:3
	};
	geetdata("../../article/pagelist.do", par, "#whdt", "whdt_list",'whdtc', false);
	
	// 季度新秀  1
	var par = {
			type:1,
			status:1,
			pageNo:1,
			pageSize:4
	};
	geetdata("../../younger/pagelist.do", par, "#qchx", "qchx_list", 'qingchunhongxin', false);
	
	// 年度新秀
	var par = {
			type:2,
			status:1,
			pageNo:1,
			pageSize:4
	};
	geetdata("../../younger/pagelist.do", par, "#qczj", "qczj_list", 'qingchunzuji', false);
	
	// 鸿鑫文化之旅 303
	var par = {
			cid:303,
			status:1,
			pageNo:1,
			pageSize:4
	};
	geetdata("../../article/pagelist.do", par, "#whzl", "whzl_list", 'hongxinwenhuazhilv', false);
	
})


